<?php

namespace App\Models\Admin;

use App\Models\Base;

class AdminNode extends Base
{

    /**
     * @var string $tableName 指定表名
     */
    protected $tableName = 'es_admin_node';

    /**
     * 修改节点
     */
    public function edit(array $param)
    {
        $where = [];
        if ($id = $param['id'] ?? '') $where['id'] = $id;

        $data = [];
        if ($nodeName = $param['node_name'] ?? '') $data['node_name'] = $nodeName;
        if ($path = $param['path'] ?? '') $data['path'] = $path;

        if (!$where || !$data) return true;
        return self::create() -> where($where) -> update($data);
    }


}